package design_mode.proxy.dynamic_proxy;

import design_mode.proxy.IUSBShop;
import design_mode.proxy.USBFactory;

import java.lang.reflect.Proxy;
import java.util.Properties;

public class Client {
    public static void main(String[] args) {
        IUSBShop iusbShop = new USBFactory();
        MyInvocationHandler myInvocationHandler = new MyInvocationHandler();
        myInvocationHandler.setUSBFactory(iusbShop);
        IUSBShop proxy = (IUSBShop) Proxy.newProxyInstance(USBFactory.class.getClassLoader(),
                iusbShop.getClass().getInterfaces(), myInvocationHandler
        );

        System.out.println("FinalResult :" + proxy.sellUSB());
    }
}
